package ru.ifmo.rybakov.muclumon.analysis2;

public class DefaultClusterDecisionStrategy implements ClusterDecisionStrategy {

	private double previousMinDistance = 0.0;
	private double previousMinDistanceDelta = 0.0;
	
	public boolean haveToStop(double minDistance) {
		double minDistanceDelta = minDistance - previousMinDistance;
		if (minDistanceDelta != 0) { 
			if (previousMinDistanceDelta > 0 && ((minDistanceDelta / previousMinDistanceDelta) > 1.25)) {
				return true; // hop detected, time to stop
			}
			previousMinDistanceDelta = minDistanceDelta;
		}
		previousMinDistance = minDistance;
		return false;
	}
}
